home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="/"> <x:schema xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" targetNamespace="http://schemas.microsoft.com/sharepoint/dsp" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:x="http://www.w3.org/2001/XMLSchema"> <xsl:apply-templates /> </x:schema> </xsl:template> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="xs:element"> <x:element> <xsl:attribute name="name"><xsl:value-of select="@name"></xsl:value-of> </xsl:attribute> <xsl:apply-templates /> </x:element> </xsl:template> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="xs:complexType"> <x:complexType xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp"> <xsl:apply-templates /> </x:complexType> </xsl:template> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="xs:attribute" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp"> <x:attribute> <xsl:attribute name="name"><xsl:value-of select="@name"></xsl:value-of> </xsl:attribute> <xsl:attribute name="use"><xsl:value-of select="@use"></xsl:value-of> </xsl:attribute> <xsl:variable name="rowname" select="concat('@',@name)"></xsl:variable> <xsl:if test="//*/xs:unique[@msdata:PrimaryKey = 'true']/xs:field[@xpath = $rowname ] or (@name='ID' and @*[local-name()='filterSupport'])"> <xsl:attribute name="dsp:keyField">true</xsl:attribute></xsl:if> <xsl:if test="//*/xs:unique[@msdata:ReadOnly = 'true']/xs:field[@xpath = $rowname ] or ((@name='Attachments' or @name='MetaInfo' or @name='ID') and @*[local-name()='filterSupport'])"> <xsl:attribute name="dsp:readOnly">true</xsl:attribute></xsl:if> <xsl:if test="@displayName"><xsl:attribute name="dsp:displayName"><xsl:value-of select="@displayName"/></xsl:attribute></xsl:if> <xsl:if test="not(@displayName)"><xsl:attribute name="dsp:displayName"><xsl:value-of select="@name"/></xsl:attribute></xsl:if> <xsl:for-each select="@*"> <xsl:if test="not(local-name()='name') and not(local-name()='use') and not(local-name()='type') and namespace-uri() = 'http://schemas.microsoft.com/sharepoint/dsp'"> <xsl:variable name="dspName" select="concat('dsp:', local-name())"/> <xsl:attribute name="{$dspName}"><xsl:value-of select="."/></xsl:attribute> </xsl:if> </xsl:for-each> <xsl:attribute name="type"> <xsl:choose> <xsl:when test="@type"><xsl:value-of select="concat('x:', substring-after(@type, ':'))"/></xsl:when> <xsl:otherwise><xsl:value-of select="concat('x:', substring-after(xs:simpleType/xs:restriction/@base, ':'))"/></xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:if test="@tableName"><xsl:attribute name="dsp:tableName"><xsl:value-of select="@tableName"/></xsl:attribute></xsl:if> <xsl:if test="xs:simpleType/xs:restriction/xs:maxLength[@value='1073741823'] or contains(@type, 'Binary')"> <xsl:attribute name="dsp:sortable">false</xsl:attribute> </xsl:if> <xsl:attribute name="dsp:filterSupport"> <xsl:choose> <xsl:when test="@*[local-name()='filterSupport']"> <xsl:value-of select="@*[local-name()='filterSupport']"/> </xsl:when> <xsl:otherwise>Eq;Neq;ViewOnly;</xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:if test="local-name()='html'"><xsl:attribute name="dsp:html"><xsl:value-of select="@*[local-name()='html']"/></xsl:attribute></xsl:if> <xsl:apply-templates /> </x:attribute> </xsl:template> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="xs:choice"> <x:sequence> <xsl:attribute name="maxOccurs"><xsl:value-of select="@maxOccurs"></xsl:value-of> </xsl:attribute> <xsl:apply-templates /> </x:sequence> </xsl:template> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="xs:sequence"> <x:sequence> <xsl:attribute name="maxOccurs"><xsl:value-of select="@maxOccurs"></xsl:value-of> </xsl:attribute> <xsl:apply-templates /> </x:sequence> </xsl:template> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="xs:choice"> <x:sequence> <xsl:attribute name="maxOccurs"><xsl:value-of select="@maxOccurs"></xsl:value-of> </xsl:attribute> <xsl:apply-templates /> </x:sequence> </xsl:template> <xsl:template xmlns:x="http://www.w3.org/2001/XMLSchema" match="xs:simpleType | xs:restriction | xs:enumeration"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates /> </xsl:copy> </xsl:template> </xsl:stylesheet>